<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增小区车辆信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-vehicle-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">车主：</label>
                    <div class="col-sm-8">
                        <select name="residentId" id="residentId" class="form-control" required>
                            <!-- 分类选项将通过 JavaScript 动态填充 -->
                            <option th:each="resident:${residents}" th:value="${resident.id}" th:text="${resident.name}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">车牌号：</label>
                    <div class="col-sm-8">
                        <input name="licensePlate" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">车辆类型</label>
                    <div class="col-sm-8">
                        <select name="vehicleTypeId" id="vehicleTypeId" class="form-control" required>
                            <!-- 分类选项将通过 JavaScript 动态填充 -->
                            <option th:value="1">轿车</option>
                            <option th:value="2">面包车</option>
                            <option th:value="3">SUV</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">停车位编号：</label>
                    <div class="col-sm-8">
                        <input name="parkingSpace" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/vehicle"
        $("#form-vehicle-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-vehicle-add').serialize());
            }
        }
    </script>
</body>
</html>